import type { R, TableDataInfo } from '@/api/model/resultModel';
import type { XhljGoodsRedemptionRecordsForm, XhljGoodsRedemptionRecordsQuery, XhljGoodsRedemptionRecordsVo } from '@/api/xhlj/model/goodsRedemptionRecordsModel';
import { request } from '@/utils/request';

// 查询商品兑换记录列表
export function listGoodsRedemptionRecords(query?: XhljGoodsRedemptionRecordsQuery) {
  return request.get<TableDataInfo<XhljGoodsRedemptionRecordsVo>>({
    url: '/xhlj/goodsRedemptionRecords/list',
    params: query,
  });
}

// 查询商品兑换记录详细
export function getGoodsRedemptionRecords(recordId: number) {
  return request.get<R<XhljGoodsRedemptionRecordsVo>>({
    url: `/xhlj/goodsRedemptionRecords/${recordId}`,
  });
}

// 新增商品兑换记录
export function addGoodsRedemptionRecords(data: XhljGoodsRedemptionRecordsForm) {
  return request.post<R<void>>({
    url: '/xhlj/goodsRedemptionRecords',
    data,
  });
}

// 修改商品兑换记录
export function updateGoodsRedemptionRecords(data: XhljGoodsRedemptionRecordsForm) {
  return request.put<R<void>>({
    url: '/xhlj/goodsRedemptionRecords',
    data,
  });
}

// 删除商品兑换记录
export function delGoodsRedemptionRecords(recordIds: number | Array<number>) {
  return request.delete<R<void>>({
    url: `/xhlj/goodsRedemptionRecords/${recordIds}`,
  });
}
